<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Zend_View_Helper_GetAllLinhasHTML
 *
 * @author desenvolvimento01
 */
class Zend_View_Helper_GetAllCoresHTML extends Zend_View_Helper_Abstract {

    public function getAllCoresHTML($tag) {
        $cores = new Application_Model_DbTable_Cores();
        $retorno = NULL;

        foreach ($cores->getAllCores() as $cor) {
            $retorno .= $this->switchElement($cor, $tag);
        }
        return $retorno;
    }

    private function switchElement(Application_Model_DAO_Cores $cor, $tag) {
        $return = NULL;
        switch ($tag) {

            case 'option':
                $return .= "<{$tag} value=\"{$cor->getIdCores()}\"> {$cor->getNomeCor()} </{$tag}> \n";
                break;

            case 'checkbox':
                $return .= "<label for=\"chk_{$cor->getIdCores()}{$cor->getNomeCor()}\"> {$cor->getNomeCor()} </label> \n";
                $return .= "<input type='{$tag}' id='chk_{$cor->getIdCores()}{$cor->getNomeCor()}' value=\"{$cor->getIdCores()}\" name='chk_cores[]' />\n";
                break;
        }
        return $return;
    }

    /**
     * Sets the view field
     * @param $view Zend_View_Interface
     */
    public function setView(Zend_View_Interface $view) {
        $this->view = $view;
    }

}

?>
